<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateAppraiseTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('appraise', function (Blueprint $table) {
            $table->id();
            $table->string('workOrderNo', 50)->default('')->comment('工单号');
            $table->unsignedInteger('shopId')->default(0)->comment('店铺id');
            $table->tinyInteger('type')->default(1)->comment('类型1-工单 2-App');
            $table->tinyInteger('score')->default(0)->comment('分数1-5');
            $table->string('tag')->default('')->comment('评价标签,多个id以逗号分割');
            $table->string('desc', 255)->default('')->comment('描述');
            $table->tinyInteger('status')->default(1)->comment('状态 1待处理 2处理中 3完成');
            $table->unsignedInteger('dealUid')->default(0)->comment('处理人id');
            $table->unsignedInteger('dealTime')->default(0)->comment('完成时间');
            $table->unsignedTinyInteger('isDeleted')->default(0)->comment('是否删除 1-是');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '评价反馈表';

            $table->index('shopId', 'idx_shopId');
            $table->index('workOrderNo', 'idx_workOrderNo');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('appraise');
    }
}
